#input thread_id,and view its posts

import wsgiref.handlers

from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from BeautifulSoup import BeautifulSoup
from xmw.tianya.bot import *

from xmw import tianya

from xmw import error
import os
import urllib2, urllib
import uuid

from google.appengine.ext import webapp

class MainPage(xmw.RequestHandler):
    def get(self):
        
        thread_q=Bot_Thread.all()

        

        result_thread    =thread_q.fetch(1000)
        
        index =1
        for thread in result_thread:
            if index %2 ==1:
                thread.line_class="odd"
            else:
                thread.line_class="even"
            
            index=index+1
            
            template_values = {
                               "thread":thread

                        }
            self.render_template(template_values, "thread")
        return

def main():
    application = webapp.WSGIApplication(
                                       [('/portal/list_thread', MainPage)],
                                       debug=True)
    wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
  main()
